package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.zzyl.common.utils.PageUtils.startPage;

/** 小程序查询护理项目Controller
 * @author ljc
 * @version V1.0
 * @date 2025-03-05 20:18
 */
@RestController
@RequestMapping("/member")
public class MemberNursingController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;

    /**
     * 查询所有护理项目
     * @param nursingProject
     * @return
     */
    @ApiOperation("查询所有护理项目")
    @GetMapping("/orders/project/page")
    public TableDataInfo<List<NursingProject>> page(NursingProject nursingProject){
        startPage();
        List<NursingProject> nursingProjects = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(nursingProjects);
    }

    /**
     *  根据id查询护理项目
     * @param id
     * @return
     */
    @ApiOperation("根据id查询护理项目")
    @GetMapping("/orders/project/{id}")
    public R<NursingProject> getProjectById(@PathVariable Long id){
        NursingProject nursingProject = nursingProjectService.selectNursingProjectById(id);
        return R.ok(nursingProject);
    }
}
